﻿define('ui/controller/gasWaterTypeController', 
	['ui/controller/conditionController'],
	function(conditionController) {

	var gasWaterTypeController = {
			
		initial: function(){
			$("em.cl-ptype>span").first().text('排污类型');
			
			gasWaterTypeController.render();
		},
		
		render: function(data){
			
			var html =  '<ul class="classify-sort-type">'+
								'<li id="cl-0" class="sort-select">'+
									'<span class="cl-area-name">'+
										'全部'+
									'</span>'+
									'<span class="cl-right-arrow">'+
									'</span>'+
								'</li>'+
								'<li id="cl-0" class="">'+
									'<span class="cl-area-name">'+
										'废气'+
									'</span>'+
									'<span class="cl-right-arrow">'+
									'</span>'+
								'</li>'+
								'<li id="cl-1" class="">'+
									'<span class="cl-area-name">'+
										'废水'+
									'</span>'+
									'<span class="cl-right-arrow">'+
									'</span>'+
								'</li>'+
						'</ul>';
			$("#gasWaterType").html(html); 
			$('#gasWaterType ul.classify-sort-type li').first().addClass('sort-select');
			
			gasWaterTypeController.onMove();
			gasWaterTypeController.onSelect();
		},
		
		onMove: function(item) {
			$('#gasWaterType ul.classify-sort-type li').each(function(){
				$(this).mouseover(function(){
					$('ul.classify-sort-type li').removeClass('sort-select');
					$(this).addClass('sort-select');
				});
			});
		},
		
		onSelect: function(item) {
			$('#gasWaterType ul.classify-sort-type li').each(function(){
				$(this).click(function(){
					$("em.cl-type>span").first().text($(this).text());
					$('#gasWaterType ul.classify-sort-type li').removeClass('sort-select');
					$(this).addClass('sort-select');
					conditionController.hideConditionList();
				});
			});
		}
	};

	return gasWaterTypeController;
});